﻿using System;
using System.IO;

namespace SomeKit.Serialization
{
    public static partial class SerializationHelper
    {
        public static T DeserializeFromStream<T>(Stream stream, Func<Stream, T> objectReader)
        {
            return objectReader(stream);
        }

        public static T DeserializeFromXmlStream<T>(Stream stream)
        {
            return DeserializeFromStream(stream, ReadObjectFromXmlStream<T>);
        }

        public static T DeserializeFromJSonStream<T>(Stream stream)
        {
            return DeserializeFromStream(stream, ReadObjectFromJsonStream<T>);
        }
    }
}
